{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Data download example\n\nThis example shows one way of dealing with large data files required for your\nexamples.\n\nThe ``download_data`` function first checks if the data has already been\ndownloaded, looking in either the data directory saved the configuration file\n(by default ``~/.sg_template``) or the default data directory. If the data has\nnot already been downloaded, it downloads the data from the url and saves the\ndata directory to the configuration file. This allows you to use the data\nagain in a different example without downloading it again.\n\nNote that examples in the gallery are ordered according to their filenames, thus\nthe number after 'plot\\_' dictates the order the example appears in the gallery.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import pandas as pd\nimport SampleModule.data_download as dd\n\n\ndata_file = dd.download_data(\n    url='http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data',\\\n    data_file_name='iris.csv',\n    data_key='data_dir')\n\niris = pd.read_csv(data_file, header=None)\niris.head()"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.8.10"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}